﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace OASystem.Controllers
{
    [App_Start.LoginFilterAtrribute]
    public class PunchController : Controller
    {
        //
        // GET: /Punch/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult PunchCard()
        {

            return View();
        }


        public ActionResult Insert()
        {

            return View();
        }


        #region 方法
        public JsonResult InsertPunch()
        {

            Model.OA_PunchCard p = new Model.OA_PunchCard()
            {
                type = int.Parse(Request["type"]),
                time1 = Request["time1"],
                time2 = Request["time2"],
                IsEable = false,
                InsertTime = DateTime.Now,
                UpdateTime = DateTime.Now
            };

            return Json(new BLL.PunchManager().Insert(p));

        }
        /// <summary>
        /// 切换考勤标准
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="Result"></param>
        /// <returns></returns>
        public JsonResult ToggleStatus(int Id, bool Result)
        {
            var result = new BLL.PunchManager().UpdateIsEnable(Id, Result);
            return Json(result);
        }

        /// <summary>
        /// 考勤打卡
        /// </summary>
        /// <returns></returns>
        public JsonResult PunchClock()
        {
            return Json(new BLL.PunchManager().CheckWork());
        }

        #endregion
    }
}
